﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;


namespace Flexfield
{
    internal abstract class DataContextDB : IDisposable
    {
        protected IFlexfield _flex;
     

        
        public IFlexfield FlexFiel
        {
            get { return _flex; }
        }

   

        /// <summary>
        /// Prevent default ctor to be called
        /// It can be called only from static function and children class
        /// </summary>                    
        protected DataContextDB()
        {
            //nothing to do
        }

        /// <summary>
        /// Clean up resorces
        /// </summary>
        public void Dispose()
        {
            _flex = null;
          
        }                
        
        /// <summary>
        /// Get entity context [writing and read to database]
        /// </summary>
        public static DataContextDB GetEntityContext( String Conect, 
                                                   string logdirectory)
        {
            DataContextDB context = new EntityContextDB(Conect, logdirectory);
            context.Initialize();
            return context;
        }

        /// <summary>
        /// Get mock context [reading and writing to the list]
        /// </summary>        
        //public static DataContext GetMockContext(string logdirectory)
        //{
        //    DataContext context = new MockContext(logdirectory);
        //    context.Initialize();
        //    return context;
        //}

        public abstract void Initialize();

    }
}
